package com.sdses.weather.model;

import com.sdses.weather.config.WeatherProviderProperties;
import lombok.Data;

@Data
public class RequestContext {
    private String cityId;
    String lat;
    String lon;
    String appcode;

    private String provider;     // 厂商名
    private int ttl;     // 失效时间 单位秒
    private String type;         // 请求类型  城市还是经纬度
    private String url;          // API 地址
    private String method ;         // API 地址
    private String token;        // Token
    private Class<?> aClass;
    private Class<?> contextClass;

    public RequestContext(WeatherProviderProperties.ReqRespConfig config) {
        this.ttl = config.getTtl();
        this.provider = config.getProvider();
        this.type = config.getType();
        this.url = config.getUrl();
        this.method = config.getMethod();
        this.token = config.getToken();
        this.aClass = config.getAClass();
        this.appcode = config.getAppCode();
        this.contextClass = config.getContextClass();
    }
}